﻿namespace ZFramework.Runtime
{
    /// <summary>
    /// 隐藏实体完成事件。
    /// </summary>
    public sealed class HideItemCompleteEventArgs : GameEventArgs
    {
        private static int _eventID = typeof(HideItemCompleteEventArgs).GetHashCode();

        /// <summary>
        /// 初始化隐藏实体完成事件的新实例。
        /// </summary>
        public HideItemCompleteEventArgs()
        {
            ItemId = 0;
            ItemAssetName = null;
            ItemGroup = null;
            UserData = null;
        }

        /// <summary>
        /// 获取实体编号。
        /// </summary>
        public int ItemId { get; private set; }

        /// <summary>
        /// 获取实体资源名称。
        /// </summary>
        public string ItemAssetName { get; private set; }

        /// <summary>
        /// 获取实体所属的实体组。
        /// </summary>
        public ItemGroup ItemGroup { get; private set; }

        /// <summary>
        /// 获取用户自定义数据。
        /// </summary>
        public object UserData { get; private set; }

        /// <summary>
        /// 创建隐藏实体完成事件。
        /// </summary>
        /// <param name="itemId">实体编号。</param>
        /// <param name="itemAssetName">实体资源名称。</param>
        /// <param name="itemGroup">实体所属的实体组。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>创建的隐藏实体完成事件。</returns>
        public static HideItemCompleteEventArgs Create(int itemId, string itemAssetName, ItemGroup itemGroup,
            object userData)
        {
            HideItemCompleteEventArgs hideEntityCompleteEventArgs = ReferencePool.Acquire<HideItemCompleteEventArgs>();
            hideEntityCompleteEventArgs.ItemId = itemId;
            hideEntityCompleteEventArgs.ItemAssetName = itemAssetName;
            hideEntityCompleteEventArgs.ItemGroup = itemGroup;
            hideEntityCompleteEventArgs.UserData = userData;
            return hideEntityCompleteEventArgs;
        }

        public override int Id
        {
            get { return _eventID; }
        }

        /// <summary>
        /// 清理隐藏实体完成事件。
        /// </summary>
        public override void Clear()
        {
            ItemId = 0;
            ItemAssetName = null;
            ItemGroup = null;
            UserData = null;
        }
    }
}
